package cn.fl.project.service;

import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cn.cmm.base.framework.exception.BaseException;
import cn.fl.capital.constant.ZGSettleScheduleEnum;
import cn.fl.capital.dto.CapCstStmScheduleDTO;
import cn.fl.project.dto.PrjPrdPaySchMDTO;

import java.util.List;

public interface IPrjSettleOfFinInstService {

    /**
     * 校验资方机构是否支持资管结清
     * 不支持抛出异常
     *
     * @param bizFlag
     * @throws BaseException
     */
    SysDictionaryDTO isSupport(String bizFlag) throws BaseException;

    int isHaveInterface(String bizFlag) throws BaseException;

    /**
     * 结清申请限制条件校验
     *
     * @param paySchId
     * @param settleType 结清方式：1-正常结清 2-提前结清(SettleConstant)
     * @return
     * @throws
     * @author liurong
     * @date 2019/5/13 11:32
     */
    boolean checkApplyConstraints(Long paySchId, String settleType) throws BaseException;

    /**
     * 获取结清开始期数
     *
     * @param paySchId
     * @return
     * @throws BaseException
     */
    Integer getStartSettlePd(Long paySchId) throws BaseException;

    /**
     * 结清数据试算
     *
     * @param prjId
     * @param paySchId
     * @param settPayPd
     * @param settleType 1-正常结清 2-提前结清
     * @return
     * @throws BaseException
     */
    PrjPrdPaySchMDTO getCalculateSettleData(Long prjId, Long paySchId, Integer settPayPd, String settleType) throws BaseException;

    /**
     * 修改支付表的我司与资方结清金额
     *
     * @param paySchId
     * @param stlAmtOther
     * @return
     * @throws BaseException
     */
    boolean modifyStlAmtOther(Long paySchId, Long stlAmtOther) throws BaseException;

    /**
     * 修改结清时间
     *
     * @param prjId
     * @param stlDt
     * @return
     * @throws BaseException
     */
    boolean modifyStlDt(Long prjId, String stlDt) throws BaseException;

    /**
     * 查询表cap_cst_stm_schedule数据标识为 1-资方接口 的列表数据
     * @param paySchId
     * @param pInstId
     * @return
     * @throws BaseException
     */
    List<CapCstStmScheduleDTO> selectScheduleListOfZG(Long paySchId, String pInstId) throws BaseException;

    /**
     * 根据主键获取schedule
     * @param id
     * @return
     * @throws BaseException
     */
    CapCstStmScheduleDTO getScheduleById(Long id) throws BaseException;

    /**
     * 更新schedule表中的信息
     * @param record
     * @return
     * @throws BaseException
     */
    int modifyScheduleOtherInfo(CapCstStmScheduleDTO record) throws BaseException;

    /**
     * 重新调用资方接口获取结清信息
     * @param prjId
     * @param paySchId
     * @param scheduleEnum
     * @throws BaseException
     */
    Long reacquire(Long prjId, Long paySchId, ZGSettleScheduleEnum scheduleEnum) throws BaseException;

}
